package com.guizi.halftimesroom.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.guizi.halftimesroom.R;
import com.guizi.halftimesroom.bean.DiscoverRecomnandTagBean;

import java.util.List;

/**
 * Created by Alan on 2016/7/20.
 */
public class RecommandTagView extends LinearLayout{
    private FlowLayout flowLayout;
    private Context mContext;

    public RecommandTagView(Context context) {
        this(context,null);
    }

    public RecommandTagView(Context context, AttributeSet attrs) {
        this(context, attrs,0);
    }

    public RecommandTagView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initView(context);
    }

    private void initView(Context context) {
        this.mContext =context;
        View view = LayoutInflater.from(mContext).inflate(R.layout.item_discover_recommand_tag,this);
        flowLayout = (FlowLayout) view.findViewById(R.id.flowlayout_recommand);
    }
    public void setData(List<DiscoverRecomnandTagBean.DataBean> list){
        for (int i = 0; i <list.size(); i++) {
            TagPurpleView tagview = new TagPurpleView(mContext);
            tagview.setData(list.get(i).getReal_name());
            flowLayout.addView(tagview);
        }
    }
}
